package com.itheima.mapper;

import com.itheima.pojo.StudentQueryParam;
import com.itheima.pojo.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

@Mapper
public interface StudentMapper {

    //添加学生信息
    List<Student> list(StudentQueryParam studentQueryParam);

    //删除学生信息

    void deleteByIds(List<Integer> ids);

    //添加学生信息
    @Insert("insert into student (name,no,gender,phone,id_card,is_college,address,degree,graduation_date,clazz_id) " +
            "values (#{name},#{no},#{gender},#{phone},#{idCard},#{isCollege},#{address},#{degree},#{graduationDate},#{clazzId})")
    void save(Student student);

    //修改学生信息

    //1.根据ID查询学生信息查询回显
    Student findById(Integer id);

    //2.更新学生信息
    void update(Student student);

    //统计学生的学历分布
    List<Map> countStudentDegreeData();

    //统计班级人数
    List<Map<String, Object>> countStudentCountData();

}
